package com.hzqy.web.login;

import java.util.Observable;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.hzqy.web.vo.UserInfoVo;

/**
 * 更新用户信息
 * @author dead
 *
 */
public class UserInfoSession extends ObserverFather {
	private static final Log LOG = LogFactory.getLog(UserInfoSession.class);
	
	public UserInfoSession(HttpServletRequest request) {
		super(request);
	}

	@Override
	public void update(Observable o, Object arg) {
		super.update(o, arg);
		if(epgInfoVo != null){
			String serverid = epgInfoVo.getOss_user_id();
//			session.setAttribute(SessionKey.SESSION_USER_TYPE, dataDao.selectUserGroup(serverid)+"");
			//更新用户信息
//			UserInfoVo userVo = dataDao.selectUserInfo(new UserInfoVo(serverid));
			
			UserInfoVo userUpdateVo = new UserInfoVo(serverid);
			userUpdateVo.setF_ui_area((String)session.getAttribute(SessionKey.SESSION_AREA));
			userUpdateVo.setF_ui_group_id(epgInfoVo.getGroup_id());
			userUpdateVo.setF_ui_group_name(epgInfoVo.getGroup_name());
			userUpdateVo.setF_ui_page_url(epgInfoVo.getPage_url());
			userUpdateVo.setF_ui_partner(epgInfoVo.getPartner());
			userUpdateVo.setF_ui_resolution(Integer.valueOf((String)session.getAttribute(SessionKey.SESSION_EPG_RESOLUTION)));
			
//			if(userVo != null){//修改
//				dataDao.updateUserInfo(userUpdateVo);
//			}else{//添加
//				dataDao.insertUserInfo(userUpdateVo);
//			}
		}
	}

}
